<template>
  <div>
    <div>
      <mt-swipe :auto="0" class="foodentry">
        <mt-swipe-item v-for="(g, index) in banner" :key="index">
          <a href="javascript:;" role="button" v-for="(b, index) in g" :key="index" @click="goTo">
            <div class="container">
              <img
                :src="b.imgSrc">
            </div>
          </a>
        </mt-swipe-item>
      </mt-swipe>
    </div>
    <div class="banner">
      <div>
        <!--广告-->
      </div>
      <div class="scroll-banner">
        <!--banner-->
        <mt-swipe :atuo="0">
          <mt-swipe-item>
            <a>
              <img
                src="https://fuss10.elemecdn.com/1/9c/d8da44b63fa1208476992df88edc9jpeg.jpeg?imageMogr/format/webp/thumbnail/568x/">
            </a>
          </mt-swipe-item>
          <mt-swipe-item>
            <a>
              <img
                src="https://fuss10.elemecdn.com/4/48/37fce9a4ffbec79293357f68ecfcbjpeg.jpeg?imageMogr/format/webp/thumbnail/568x/">
            </a>
          </mt-swipe-item>
        </mt-swipe>
      </div>
    </div>
    <div id="shoplist-title" class="shoplist-title">
      推荐商家
    </div>
    <div class="list-filter">
      <!--商家列表-->
      <aside class="filter">
        <div class="filter-header">
          <a class="filter-nav active">
            <span>综合排序</span>
          </a>
          <a class="filter-nav">
            <span>距离最近</span>
          </a>
          <a class="filter-nav">
            <span>品质联盟</span>
          </a>
          <a class="filter-nav">
            <span>筛选</span>
          </a>
        </div>
      </aside>
    </div>

    <section class="shoplist">
      <section class="shop_item" v-for="n in 10">
        <div class="container">
          <div class="logo">
            <div>
              <img
                src="https://fuss10.elemecdn.com/e/17/27fa41fc2b03b1b8c2d794a5cf139jpeg.jpeg?imageMogr/format/webp/thumbnail/!130x130r/gravity/Center/crop/130x130/">
            </div>
          </div>
          <div class="index-main">
            <section class="index-line">
              <h3 class="index-name">
                <span>品牌</span>
                <span>汉堡王（淄博华光路点201444淄博华光路点201444）</span>
              </h3>
              <ul class="dot">
                <span>...</span>
              </ul>
            </section>
            <section class="index-line">
              <div class="index-rateWrap">
                <div class="rateWrap">
                  <div class="rateGrap"><img
                    src="">
                  </div>
                  <div class="rateActive"><img
                    src="">
                  </div>
                </div>
                <span>4.8</span>
                <span>月售1287单</span>
              </div>
              <div class="delivery">
                <div class="icon" content="蜂鸟快递">蜂鸟快递</div>
              </div>
            </section>
            <section class="index-line">
              <div class="money">
                <span>
                  ￥15起送
                </span>
                <span>
                  远距离配送费￥1.5
                </span>
              </div>
              <div class="time">
                <span>1.9km</span>
                <span>21分钟</span>
              </div>
            </section>
          </div>
        </div>
        <div class="coupon">
          <section class="tag">
            <!--标签信息-->
            <span class="tag-items">汉堡
              <span>汉堡</span>
            </span>
            <span class="tag-items">品牌联盟
              <span>品牌联盟</span>
            </span>
          </section>
          <span><img
            src=""
            class="index-dashedline_7B79b3W"></span>
          <section class="list">
            <div class="left">
              <!--标签列表-->
              <div class="item">
                <span class="icon">
                  <span>减</span>
                </span>
                <span class="desc">满65减15，满90减30</span>
              </div>
              <div class="item">
                <span class="icon">
                  <span>折</span>
                </span>
                <span class="desc">折扣商品五折起</span>
              </div>
              <div class="item">
                <span class="icon">
                  <span>减</span>
                </span>
                <span class="desc">新用户下单立减17元</span>
              </div>
              <div class="item">
                <span class="icon">
                  <span>减</span>
                </span>
                <span class="desc">特价商品9.9元起</span>
              </div>
            </div>
            <div class="right">
              <!--列表展开按钮-->
              <span class="text">三个活动</span>
              <img
                src=""
                class="">
            </div>
          </section>
        </div>
      </section>
    </section>
  </div>
</template>

<script>
  import {mapGetters} from 'vuex'

  export default {
    name: "",
    data() {
      return {
        foodList : []
      }
    },
    computed : {
      ...mapGetters(['banner'])
    },
    methods: {
      goTo (event) {
        this.$router.push({path: '/food_list', query: {type: 1}})
      }
    },
    mounted (){
      this.$store.dispatch('banner')
    },
    components: {}
  }
</script>

<style lang="scss" type="text/scss">
  div {
    font-size: 12px;
  }

  img {
    width: 100%;
    height: 100%;
  }

  .mint-swipe-indicator {
    width: 10px;
    height: 2px;
    border-radius: 1px;
  }

  .mint-swipe-indicator.is-active {
    background-color: aqua;
  }

  /*分类录播*/
  .foodentry {
    overflow: hidden;
    background-color: #ffffff;
    height: 200px;
    text-align: center;

    a {
      position: relative;
      width: 20%;
      float: left;
      margin-top: 22px;
    }
    .container {
      position: relative;
      display: inline-block;
      width: 60px;
      height: 60px;
    }

  }

  /*广告轮播*/
  .banner {
    .scroll-banner {
      height: 100px;
      img {
        max-width: 100%;
        height: auto;
      }
    }
  }

  /*列表筛选*/
  .shoplist-title {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    font-size: 14px;
    &::after {
      content: "";
      width: 20px;
      height: 2px;
      display: block;
      background-color: #999;
      margin-left: 10px;
    }
    &::before {
      content: "";
      width: 20px;
      height: 2px;
      display: block;
      background-color: #999;
      margin-right: 10px;
    }
  }

  .list-filter {
    position: sticky;
    top: 0px;
    z-index: 10;
  }

  .filter {
    position: relative;
    height: 40px;
    line-height: 40px;
  }

  .filter-header {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    background-color: #ffffff;
  }

  .filter-nav {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #666;
    font-size: 14px;
    overflow: hidden;
  }

  .filter-nav.active {
    font-weight: bold;
    color: #000;
  }

  /*列表*/
  .shoplist {
    background-color: #ffffff;
  }

  .shop_item {
    padding: 10px 0px;
    color: #666666;
    border-bottom: 1px solid #eee;
  }

  /*商家主体信息*/
  .container {
    padding: 0 10px;
    display: flex;
    justify-content: flex-start;
    > div {

    }
  }

  .logo {
    div {
      width: 65px;
      height: 65px;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }

  .index-main {
    display: flex;
    flex: 1;
    justify-content: space-between;
    flex-direction: column;
    overflow: hidden;
    font-size: 12px;
    margin-left: 10px;
    .index-line {
      display: flex;
      flex: 1;
      justify-content: space-between;
      overflow: hidden;
      line-height: normal;
    }
    .index-name {
      margin: 0;
      padding: 0;
      font-size: 13px;
      overflow: hidden;
      display: flex;
      span:first-child {
        padding-right: 5px;
        white-space: nowrap
      }
      span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: bold
      }
    }
    .dot {
      width: 20px;
      padding: 0;
      margin: 0;
      margin-left: 10px;
      list-style: none;
      display: flex
    }
    .index-rateWrap {
      display: flex;
      align-items: center;
      .rateWrap {
        position: relative;
        overflow: hidden;
        display: inline-block;
        vertical-align: middle;
        .rateGrap {
          display: flex;
        }
        .rateActive {
          position: absolute;
          top: 0;
          left: 0;
          overflow: hidden;
          display: flex;
        }
        .rateGrap, .rateActive {
          img {
            width: 56px;
            height: 10px;
            flex: none;
            max-width: none;
          }
        }
      }
    }
    .time {
      color: #999;
      display: flex;
      align-items: center;
      justify-content: center;
      span:first-child::after {
        content: "|";
        color: #666;
        margin: 0 3px;
      }
    }
    .delivery {
      display: flex;
      align-items: center;
      .icon {
        color: transparent;
        position: relative;
        &::after {
          position: absolute;
          top: 0;
          left: 0;
          content: attr(content);
          background-image: linear-gradient(45deg, #0085ff, #0af);
          color: #fff;
          transform: scale(0.8);
        }
      }
    }
    .money {
      display: flex;
      align-items: center;
      justify-content: space-between;
      span:last-child {
        &::before {
          content: '|';
          margin: 3px;
        }
      }
    }
  }

  /*商家优惠信息*/
  .coupon {
    padding-left: 85px;
    .tag {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      margin-top: 10px;

      .tag-items {
        position: relative;
        color: transparent;
        white-space: nowrap;
        font-size: 12px;
        margin: 0 5px 3px 0;
        padding: 2px;
        span {
          position: absolute;
          top: 0;
          left: 0;
          border: 1px solid rgb(211, 211, 211);
          color: rgb(102, 102, 102);
          border-radius: 5px;
        }
      }
    }
    .list {
      display: flex;
      justify-content: space-between;
      position: relative;
      align-content: stretch;
      overflow: hidden;
      .left {
        flex: 1;
        overflow: hidden;
        .item {
          margin-top: 3px;
          display: flex;
          align-items: center;
          flex: 1;
          overflow: hidden;
          line-height: 1.3;
          .icon {
            display: inline-block;
            height: 15px;
            width: 15px;
            vertical-align: middle;
            position: relative;
            font-size: 20px;
            color: transparent;
            margin-right: 5px;
            span {
              position: absolute;
              top: 0;
              left: 0;
              color: #fff;
              background-color: rgb(241, 115, 115);
              display: flex;
              justify-content: center;
              align-items: center;
              transform: scale(0.5);
              padding: 2px;
              transform-origin: 0 0;
              width: 25px;
              height: 25px;
            }
          }
          .desc {
            display: inline-block;
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }

        }
      }
      .right {
        padding: 10px;
        text-align: right;
        .text {
        }
        img {
          width: 8px;
          height: 4px;
        }
      }

    }
  }
</style>
